package com.fyzk.activity.lottery.recommend_order;

import android.os.Bundle;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.widget.ProgressBar;

import com.fyzk.base.BaseActivity;
import com.tyjc.lottery.R;
import com.fyzk.view.TopTitleView;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;

import com.wf.domain.UrlDef;

/**
 * Created by fanxs11 on 2017/8/25.
 */
@ContentView(R.layout.ac_recommend_help)
public class RecommendHelpActivity extends BaseActivity {

    @ViewInject(R.id.recommend_help_topview)
    private TopTitleView topView;
    @ViewInject(R.id.recommend_help_webview)
    private WebView webView;
    @ViewInject(R.id.recommend_help_progress)
    private ProgressBar progressbar;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        topView.setOnTitleClickListener(this);

        String url = UrlDef.followUrl + "shaidan/sdintroduce.html";
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setBuiltInZoomControls(true);
        webView.setWebChromeClient(new WebChromeClient() {
            @Override
            public void onProgressChanged(WebView view, int newProgress) {
                super.onProgressChanged(view, newProgress);
                if (newProgress == 100) {
                    progressbar.setVisibility(View.GONE);
                } else {
                    if (progressbar.getVisibility() == View.GONE) {
                        progressbar.setVisibility(View.VISIBLE);
                    }
                    progressbar.setProgress(newProgress);
                }
                super.onProgressChanged(view, newProgress);
            }
        });
        webView.loadUrl(url);
    }
}
